<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:core="http://www.contact.core.com/contacts/core/ui"
      xmlns:common="http://www.contact.common.com/contacts/ui"
      xmlns:a4j="http://richfaces.org/a4j"
        >

<ui:component>
    <link rel="stylesheet" type="text/css" href="./style/css/main.css"/>
    <rich:panel id="profileRightCenterPanel"
                style="overflow:auto; width:100%; border:none; "
                bodyClass="rich-laguna-panel-no-header">

        <h:panelGrid columns="1">
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel
                            value="#{profileSessionBean.information.firstName} #{profileSessionBean.information.lastName}"/>
                    <h:outputLabel  id="rightCenterCurrentWallPost" rendered="#{profile.canSeeAllProfile}" value=" - ">
                          <h:outputLabel  value=" #{profile.currentWallPost}"/>
                    </h:outputLabel>

                    <a4j:commandButton rendered="#{ not profile.canSeeAllProfile}"
                                       value="#{resources.addAsAfriendLabel}"
                                       action="#{newFriendBean.prepareToSendRequest}"
                                       reRender="addNewFriendRequestModalPanel"
                                       oncomplete="if(data)Richfaces.showModalPanel('addNewFriendRequestModalPanel');"
                                       limitToList="true"
                                       data="#{newFriendBean.canAdd}"
                            >
                        <f:setPropertyActionListener value="#{profileSessionBean.information.id}"
                                                     target="#{newFriendBean.informationIdForProccess}"/>
                    </a4j:commandButton>
                </h:panelGrid>

            </h:form>

            <h:panelGroup style="width:100%">
                <rich:tabPanel selectedTab="#{profile.profileTab}" switchType="server">
                    <rich:tab rendered="#{profile.canSeeAllProfile}"
                              id="profileTabOne" ajaxSingle="true"
                              switchType="client" label="#{resources.wallLabel}"
                              onlabelclick="setTabOne();">
                        <h:panelGroup styleClass="profileTab" layout="block">
                            <core:wallProfileTab/>
                        </h:panelGroup>

                    </rich:tab>
                    <rich:tab id="profileTabTwo" ajaxSingle="true" switchType="client" style="height:auto;" label="#{resources.infoLabel}"
                              onlabelclick="setTabTwo();">
                        <h:panelGroup rendered="#{profile.canSeeAllProfile}" styleClass="profileTab" layout="block">
                            <core:infoProfileTab/>
                        </h:panelGroup>
                        <h:panelGroup rendered="#{not profile.canSeeAllProfile}" styleClass="profileTab" layout="block">
                            <core:noPermissionInfoView/>
                        </h:panelGroup>

                    </rich:tab>

                    <rich:tab rendered="#{profile.canSeeAllProfile}"
                              id="profileTabThree" ajaxSingle="true"
                              switchType="client" label="#{resources.photosLabel}"
                              onlabelclick=" setTabThree();">
                        <h:form id="photosForm">
                            <h:panelGroup id="photosProfileTabPanel" styleClass="profileTab" layout="block">
                                <!--<h:outputLabel value="#{profile.profileTab}"/>-->
                                <h:panelGroup rendered="#{profile.profileTab eq 'profileTabThree'}">
                                    <ui:include src="#{photosBean.rightCenterPageView}"/>
                                </h:panelGroup>

                                <!--<core:photosProfileTab/>-->
                            </h:panelGroup>
                        </h:form>
                        <common:confirmModalPanel id="confirmationRemovePicturePanel"
                                                  reRender="pictureForEditPanel, requestRichPanel, photosForm"
                                                  header="#{pictureSessionBean.header}"
                                                  message="#{pictureSessionBean.message}"
                                                  bean="#{pictureBean}"
                                                  submitButton="#{resources.removeLabel}"/>
                    </rich:tab>

                </rich:tabPanel>
            </h:panelGroup>

        </h:panelGrid>
        <h:form>
            <a4j:jsFunction name="setTabOne"
                            reRender="leftContentProfilPanel"
                            action="#{profile.assignLeftContentView}">
                <f:setPropertyActionListener value="profileTabOne" target="#{profile.profileTab}"/>
            </a4j:jsFunction>
            <a4j:jsFunction name="setTabTwo"
                            reRender="leftContentProfilPanel"
                            action="#{profile.assignLeftContentView}">
                <f:setPropertyActionListener value="profileTabTwo" target="#{profile.profileTab}"/>
            </a4j:jsFunction>
            <a4j:jsFunction name="setTabThree"
                            reRender="leftContentProfilPanel, photosForm"
                            action="#{profile.preparePhotosTab}">
                <f:setPropertyActionListener value="profileTabThree"
                                             target="#{profile.profileTab}"/>
            </a4j:jsFunction>
        </h:form>
    </rich:panel>
    <common:confirmModalPanel id="deleteAlbumPanel"
                              bean="#{photosBean}"
                              message="#{photosSessionBean.message}"
                              header="#{photosSessionBean.header}"
                              reRender="leftContentProfilPanel"/>

</ui:component>


</html>
